//
//  AnswerTableViewCell.swift
//  MetaTest
//
//  Created by yhb on 2024/10/26.
//

import UIKit

class AnswerTableViewCell: UITableViewCell {

    @IBOutlet weak var loadingView: UIActivityIndicatorView!
    @IBOutlet weak var answerLabel: UILabel!
    
    func configure(with answer: String?, isLastSection: Bool) {
            if isLastSection && (answer == nil || answer!.isEmpty) {
                loadingView.isHidden = false
                loadingView.startAnimating()
                answerLabel.isHidden = true
            } else {
                loadingView.stopAnimating()
                loadingView.isHidden = true
                answerLabel.isHidden = false
                answerLabel.text = answer
            }
        }
        
        override func prepareForReuse() {
            super.prepareForReuse()
            loadingView.stopAnimating()
            loadingView.isHidden = true
        }
    
    override func awakeFromNib() {
        super.awakeFromNib()
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        
    }
    
}
